home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / twars.arc / MAINT.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-28  |  6KB  |  181 lines

  1.  
  2. OVERLAY PROCEDURE initship;
  3.  
  4.   VAR
  5.       b,c,z  : INTEGER;
  6.       done   : boolean;
  7.       choosy : str;
  8.       tmoney : integer;
  9. BEGIN
  10.   nl;
  11.   done := FALSE;
  12.   ansic(8);
  13.   print('Your ship is being initialized.');
  14.   ansic(1);
  15. {  removeship(pn);  }
  16.   readin(1,usert);
  17.   a := 100 * usert.fh;     (* 100 credits for each fighter *)
  18.   b := usert.fi;           (* amount of starter capitol    *)
  19.   c := 500 * usert.fj;     (* 500 credits for each hold    *)
  20.   readin(pn,userr);
  21.   WITH userr DO
  22.     BEGIN
  23.       fb := pd;
  24.       fc := 0;
  25.       fd := tt;
  26.       fe := 0;
  27.       ff := 1;
  28.       fg := a div 100;
  29.       fh := c div 500;
  30.       fi := 0;
  31.       fj := 0;
  32.       fk := 0;
  33.       fr := 0;
  34.       credits := b;
  35.       fm := 1;
  36.     END;
  37.     repeat
  38.     nl;
  39.     ansic(7);
  40.     print('Your new ship is currently equipped as follows:');
  41.     nl;
  42.     ansic(5);
  43.     print('     Holds  Fighters   Shields');
  44.     ansic(3);
  45.     print(addblank(cstr(userr.fh),10)+addblank(cstr(userr.fg),10)+addblank(cstr(userr.fe),10));
  46.     nl;
  47.     ansic(3);
  48.     print('Your remaining cash is: '+addblank(cstrr(userr.credits,10),6)+' (Save some for trading!)');
  49.     nl;
  50.     ansic(4);
  51.     prompt('Do you want to change this setup? ');
  52.     if yn then
  53.       begin
  54.         ansic(5);
  55.         prompt('H to change Holds, F to change Fighters, S to change Shields ');
  56.         mmkey(choosy);
  57.         case choosy of
  58.         'H' : begin
  59.                 ansic(3);
  60.                 prompt('Buy or Sell Holds?  (1 hold is worth 500 credits) ');
  61.                 mmkey(choosy);
  62.                 if choosy = 'B' then
  63.                   begin
  64.                     prompt('How many to Buy? ');
  65.                     input(choosy,3);
  66.                     z := abs(value(choosy));
  67.                     if ((z * 500.0) <= userr.credits) then
  68.                       begin
  69.                         userr.fh := userr.fh + z;
  70.                         userr.credits := userr.credits - (z * 500.0);
  71.                       end
  72.                     else
  73.                       begin
  74.                         ansic(8);
  75.                         print('You don''t have the funds!');
  76.                       end;
  77.                   end
  78.                 else
  79.                 if choosy = 'S' then
  80.                   begin
  81.                     prompt('How many to Sell? ');
  82.                     input(choosy,3);
  83.                     z := abs(value(choosy));
  84.                     if z <= userr.fh then
  85.                       begin
  86.                         userr.fh := userr.fh - z;
  87.                         userr.credits := userr.credits + (z * 500.0);
  88.                       end
  89.                     else
  90.                       begin
  91.                         ansic(8);
  92.                         print('You don''t have that many!');
  93.                       end;
  94.                   end;
  95.               end;
  96.         'F' : begin
  97.                 ansic(3);
  98.                 prompt('Buy or Sell Fighters?  (1 fighter is worth 100 credits) ');
  99.                 mmkey(choosy);
  100.                 if choosy = 'B' then
  101.                   begin
  102.                     prompt('How many to Buy? ');
  103.                     input(choosy,3);
  104.                     z := abs(value(choosy));
  105.                     if ((z * 100.0) <= userr.credits) then
  106.                       begin
  107.                         userr.fg := userr.fg + z;
  108.                         userr.credits := userr.credits - (z * 100.0);
  109.                       end
  110.                     else
  111.                       begin
  112.                         ansic(8);
  113.                         print('You don''t have the funds!');
  114.                       end;
  115.                   end
  116.                 else
  117.                 if choosy = 'S' then
  118.                   begin
  119.                     prompt('How many to Sell? ');
  120.                     input(choosy,3);
  121.                     z := abs(value(choosy));
  122.                     if z <= userr.fg then
  123.                       begin
  124.                         userr.fg := userr.fg - z;
  125.                         userr.credits := userr.credits + (z * 100.0);
  126.                       end
  127.                     else
  128.                       begin
  129.                         ansic(8);
  130.                         print('You don''t have that many!');
  131.                       end;
  132.                   end;
  133.               end;
  134.         'S' : begin
  135.                 ansic(3);
  136.                 prompt('Buy or Sell Shields?  (1 shield is worth 100 credits) ');
  137.                 mmkey(choosy);
  138.                 if choosy = 'B' then
  139.                   begin
  140.                     prompt('How many to Buy? ');
  141.                     input(choosy,3);
  142.                     z := abs(value(choosy));
  143.                     if ((z * 100.0) <= userr.credits) then
  144.                       begin
  145.                         userr.fe := userr.fe + z;
  146.                         userr.credits := userr.credits - (z * 100.0);
  147.                       end
  148.                     else
  149.                       begin
  150.                         ansic(8);
  151.                         print('You don''t have the funds!');
  152.                       end;
  153.                   end
  154.                 else
  155.                 if choosy = 'S' then
  156.                   begin
  157.                     prompt('How many to Sell? ');
  158.                     input(choosy,3);
  159.                     z := abs(value(choosy));
  160.                     if z <= userr.fe then
  161.                       begin
  162.                         userr.fe := userr.fe - z;
  163.                         userr.credits := userr.credits + (z * 100.0);
  164.                       end
  165.                     else
  166.                       begin
  167.                         ansic(8);
  168.                         print('You don''t have that many!');
  169.                       end;
  170.                   end;
  171.               end;
  172.           end;   (* of case statement *)
  173.       end
  174.     else
  175.       done := true;
  176.   until DONE or HANGUP;
  177.   writeout(pn,userr);
  178.   addship(pn);
  179. END;
  180.  
  181.